<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {

public function login(){

 $this->display();
      
 }
 //
 public function dologin(){
      $adminmodel=M('admin');
      $data["admin_name"]=I("post.admin_name");
      $data["password"]=I("post.password");
      // $data["password"]=md5(I("post.password"));
      $rs=$adminmodel->where($data)->select();
      // $apic=$rs[0]["adminpic"];
      $id=$rs[0]["admin_id"];
       // dump($aliasname);exit;
      // echo($adminmodel->getLastSql());exit;
      if($rs){
         session("admin_name",$data['admin_name']);
          // session("apic",$apic);
          session("admin_id",$id);
          // dump(session());exit;
          redirect(U("index.php/Admin/Index/shouye"));
        // $this->success("登录成功",U('Competition/competition_list'));
      }else{
        $this->error("用户名或密码错误");
      }
      
 }

}?>
